package com.hnichr.ump.plan.controller;


import com.hnichr.ump.common.plan.service.PlanAuthService;
import com.hnichr.ump.common.plan.vo.PlanAuthVo;
import com.mxpioframework.common.vo.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
@RequestMapping("/plan/auth/v1/")
@Tag(name = "PlanAuthController", description = "部门计划权限接口")
public class PlanAuthController {

    @Autowired
    private PlanAuthService planAuthService;

    @GetMapping("edit")
    @Operation(summary = "获取当前登录用户编辑权限", description = "获取当前登录用户编辑权限", method = "GET")
    public Result<String> getEditAuth() {
        try{
            PlanAuthVo planAuthVo = planAuthService.getUserAuth();
            return Result.OK(planAuthVo.getEdit().toString());
        }
        catch (Exception e){
            return Result.error(e.getMessage());
        }
    }
}
